package com.itHuangTao.tank.collisions;

import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.entity.Entity;
import com.almasb.fxgl.physics.CollisionHandler;
import com.itHuangTao.tank.Config;
import com.itHuangTao.tank.GameType;

public class BulletBulletHandler extends CollisionHandler {
    public BulletBulletHandler() {
        super(GameType.BULLET,GameType.BULLET);
    }

    @Override
    protected void onCollisionBegin(Entity b1, Entity b2) {
        FXGL.spawn("explode",b1.getCenter()
                .subtract(50/2.0,50/2.0));//在子弹处爆炸
        GameType t1=b1.getObject("ownerType");
        GameType t2=b2.getObject("ownerType");
        if(t1!=t2){
            b1.removeFromWorld();
            b2.removeFromWorld();
        }
    }
}
